package com.lezhi.socialgram.api.lbs;

import com.lezhi.socialgram.util.ValidUtils;
import com.lezhi.socialgram.model.lbs.LbsCondition;
import com.lezhi.socialgram.service.lbs.LbsService;
import com.lezhi.socialgram.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * Created by daizhen on 2017/3/27.
 */
@RestController
public class LbsApi {

    private static final Logger logger = LoggerFactory.getLogger(LbsApi.class);

    @Autowired
    LbsService lbsService;

    @PostMapping("/queryUserNearly")
    public Result queryUserNearly(@RequestBody @Valid LbsCondition lbsCondition, BindingResult bindingResult) {
        ValidUtils.valid(logger, bindingResult);
        return lbsService.queryPersonNearlyByUserId(lbsCondition);
    }

}
